<?php


if (!isset($_SESSION['id'])) {
    header('Location: login.php');
    exit;
}
include_once ("../controller/ocorrencia_controller_class.php");
include_once("../controller/ocorrencia_controller_class.php");
include_once("../controller/tipo_ocorrencia_controller_class.php");
include_once("../controller/campus_controller_class.php");
include_once("../controller/predio_controller_class.php");
include_once("../controller/sala_controller_class.php");

//PREENCHER COMBOS

$objEspec = new EspecialidadeController();

$objUrgencia = new UrgenciaController();
$objCampus = new CampusController();

$listEspec = $objEspec->selecionar();
$listUrgencia = $objUrgencia->selecionar();
$listCampus = $objCampus->selecionar();

//PREENCHER COMBOS

?>
<!DOCTYPE html>
<html lang="en" class="no-js">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <title>::: SOS UNITAU -- Sistema de ordem de serviço</title>

        <link rel="shortcut icon" href="img/logo.jpg">
        <link rel="stylesheet" type="text/css" href="css/normalize.css" />
        <link rel="stylesheet" type="text/css" href="css/demo.css" />
        <link rel="stylesheet" type="text/css" href="css/icons.css" />
        <link rel="stylesheet" type="text/css" href="css/style2.css" />
        <link rel="stylesheet" type="text/css" href="css/StylePage.css" />
        <link rel="stylesheet" type="text/css" href="css/default.css" />
        <link rel="stylesheet" type="text/css" href="css/component.css" />
        <link rel="stylesheet" type="text/css" href="css/shadowbox.css" />
        <link href="css/StyleOS.css" type="text/css" rel="stylesheet" />
        <link href="css/style_light.css" type="text/css" rel="stylesheet" />
        <script src="js/modernizr.custom.js"></script>
        <script src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery1.6.min.js"></script>
        <script src="js/jquery.maskedinput-1.3.min.js"></script>
        <script src="js/jquery-ui-1.8.14.custom.min.js"></script>
        <script src="js/shadowbox.js"></script>
        <script type="text/javascript">
            Shadowbox.init();
        </script>

        <script>
            $(document).ready(function () {
                $("#txtCategoria").change(function () {
                    var cat = $("#txtCategoria").val();

                    $('#txtTipo').find('option').remove();
                    $.post("../funcoes/tipoPorCategoria.php", {id: cat}, function (retorno) {
                        $("#txtTipo").append("<option value='0'> Selecione</option>");

                        $.each(retorno, function (key, value) {
                            //                        alert(value.id + " " + value.nome);
                            $("#txtTipo").append("<option value='" + value.id + "'> " + value.nome + "</option>");
                        });
                        $("#txtTipo").append("<option value='-1'> Outro</option>");

                    }, 'json').fail(function () {
                        alert("erro");
                    });

                });
            });
        </script>
        
        
    </head>
    <!--------------------------------------------------------------------------------------------------->

    <body> <!-- Inicio -->
        
            <form name="altFuncionario" id="altFuncionario" method="post" enctype="multipart/form-data" action="" class="style-form">
                <fieldset style="height:auto;">

                    <legend>Informações de busca:</legend>
                    <table width="800px" class="table-form">
<!--                        <tr>
                            <td> <label for="txtOs"> Código da OS: </label> </td>
                            <td> <input name="txtOs" id="txtOs" type="text" required  placeholder="Ex: OS 33" /></td>
                        </tr>-->

                        <tr>
                            <td> 
                                <label for="txtCampus"> Campus: </label> 
                            </td>
                            <td> 
                                <select name="txtCampus" id="txtCampus" class="filtros" style="width:150px">
                                    <option value="0">Selecione</option>
                                    <?php if (count($listCampus) > 0) { ?>
                                        <?php foreach ($listCampus as $campus) { ?>
                                            <option value="<?= $campus->getId() ?>"><?= $campus->getNome() ?></option>
                                            <?php
                                        }
                                    }
                                    ?>
                                </select>
                            </td>

                        </tr>

                        <tr>
                            <td> 
                                <label for="txtCategoria"> Categoria: </label> 
                            </td>
                            <td> 
                                <select name="txtCategoria" id="txtCategoria" class="filtros" style="width:150px">
                                    <option value="0">Selecione</option>
                                    <?php if (count($listEspec) > 0) { ?>
                                        <?php foreach ($listEspec as $categoria) { ?>
                                            <option value="<?= $categoria->getId() ?>"><?= $categoria->getNome() ?></option>
                                            <?php
                                        }
                                    }
                                    ?>
                                </select> 
                            </td>


                        </tr>

                        <tr>
                            <td> 
                                <label for="txtTipo"> Tipo de Ocorrência: </label> 
                            </td>
                            <td> 
                                <select name="txtTipo" id="txtTipo" class="filtros" style="width:150px">
                                    <option value="0">Selecione</option>
                                </select> 
                            </td>


                        </tr>

                        <tr>
                            <td> 
                                <label for="txtUrgencia"> Urgência: </label> 
                            </td>
                            <td> 
                                <select name="txtUrgencia" id="txtUrgencia" class="filtros" style="width:150px">
                                    <option value="0">Selecione</option>
                                    <?php if (count($listUrgencia) > 0) { ?>
                                        <?php foreach ($listUrgencia as $urg) { ?>
                                            <option value="<?= $urg->getId() ?>"><?= $urg->getNome() ?></option>
                                            <?php
                                        }
                                    }
                                    ?>
                                </select> 
                            </td>

                        </tr> 

                    </table>
<!--
                    <input type="button" value="Buscar" style="display:inline-block; margin-left:75%; margin-top:3%;" class="botao" />
                    <input type="button" value="Cancelar" style="margin-left:5%;" class="botao" onclick=""/>
                    -->
                </fieldset>

            </form>

    </body><!-- Fim -->
    <!--------------------------------------------------------------------------------------------------->
    <script src='//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
    <script src='http://cdn.jsdelivr.net/jquery.mixitup/latest/jquery.mixitup.min.js'></script>
    <script src='//cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
    <script>$(function () {
                $('#Container').mixItUp({
                    load: {
                        filter: '.category-1'
                    }
                });
            });//@ sourceURL=pen.js
    </script>

    <script src='http://codepen.io/assets/editor/live/css_live_reload_init.js'></script>
    <script src="js/classie.js"></script>
    <script src="js/borderMenu.js"></script>

    <!-- SCRIPTS POP-UP -->
    <script>
            function abrir(URL) {

                var width = 850;
                var height = 500;

                var left = 240;
                var top = 90;

                window.open(URL, 'janela', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=no, status=no, toolbar=0, location=no, 			directories=no, menubar=no, resizable=0 ,maximized=no, fullscreen=no');

            }

    </script>


    <!-- SCRIPTS POP-UP -->
    <script>
        function abrir(URL) {

            var width = 850;
            var height = 500; //ALTERADO, PARA UMA BOA VISUALIZAÇÃO

            var left = 240;
            var top = 100;

            window.open(URL, 'janela', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=no, status=no, toolbar=no, location=no, 			directories=no, menubar=no, resizable=0,maximized=no, fullscreen=no');

        }



    </script>

    <!-- /SCRIPTS POP-UP -->

    
</html>


